import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/demo/demo2',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/demo1',
      name: 'demo1',
      component: () => import('../views/basis/demo1.vue')
    },
    {
      path: '/demo2',
      name: 'demo2',
      component: () => import('../views/basis/demo2.vue')
    },
    {
      path: '/demo3',
      name: 'demo3',
      component: () => import('../views/basis/demo3.vue')
    },
    {
      path: '/practice',
      name: 'practice',
      children: [
        {
          path: 'exercise1',
          name: 'exercise1',
          component: () => import('../views/practice/exercise1.vue'),
        },
        {
          path: 'exercise2',
          name: 'exercise2',
          component: () => import('../views/practice/exercise2.vue'),
        },
        {
          path: 'exercise3',
          name: 'exercise3',
          component: () => import('../views/practice/exercise3.vue'),
        },
        {
          path: 'exercise4',
          name: 'exercise4',
          component: () => import('../views/practice/exercise4.vue'),
        },
        {
          path: 'exercise5',
          name: 'exercise5',
          component: () => import('../views/practice/exercise5.vue'),
        },
        {
          path: 'exercise6',
          name: 'exercise6',
          component: () => import('../views/practice/exercise6.vue'),
        },
        {
          path: 'exercise7',
          name: 'exercise7',
          component: () => import('../views/practice/exercise7.vue'),
        },
        {
          path: 'exercise8',
          name: 'exercise8',
          component: () => import('../views/practice/exercise8.vue'),
        }
      ]
    },
    {
      path: '/demo',
      name: 'demo',
      children: [
        {
          path: 'mouseCtrl',
          name: 'mouseCtrl',
          component: () => import('../views/demo/mouseCtrl.vue'),
        },
        {
          path: 'demo2',
          name: 'demo2',
          component: () => import('../views/demo/demo2.vue'),
        },
        {
          path: 'demo3',
          name: 'demo3',
          component: () => import('../views/demo/demo3.vue'),
        },
        {
          path: 'demo4',
          name: 'demo4',
          component: () => import('../views/demo/demo4.vue'),
        },
        {
          path: 'demo5',
          name: 'demo5',
          component: () => import('../views/demo/demo5.vue'),
        },
      ]
    },
    {
      path: '/projects',
      name: 'projects',
      children: [
        {
          path: 'co2',
          name: 'co2',
          component: () => import('../views/projects/co2.vue'),
        },
      ]
    }
  ]
})

export default router
